// class组件使用ts
import React, { PureComponent } from 'react'

interface IProps {
  name: string
  age?: number
}

interface IState {
  counter: number
  message: string
}
// interface ISnapshot {
//   address: string
// }
export default class ClassTs extends PureComponent<IProps, IState> {
  name = 'aaa'
  state = {
    message: 'Hello Wold',
    counter: 99
  }
  getSnapshotBeforeUpdate() {
    return { address: '洛杉矶' }
  }
  render(): React.ReactNode {
    return (
      <div>
        name: {this.props.name}
        age: {this.props.age}
        message: {this.state.message}
      </div>
    )
  }
}
